package day_2022_7_to_8.day48;

import java.util.ArrayList;
import java.util.List;

/**
 * @author haomin
 * @date 2022/08/06 17:44
 **/
public class Day22_1_Num1408_StringMatching {
    public static void main(String[] args) {
        String[] words = new String[]{"mass","as","hero","superhero"};
        stringMatching(words);
    }
    public static List<String> stringMatching(String[] words) {
        List<String> res = new ArrayList<>();
        for (int i = 0; i < words.length; i++) {
            for (int j = 0; j < words.length; j++) {
                if(j != i && words[j].contains(words[i]) && !res.contains(words[i]))
                    res.add(words[i]);
            }
        }
        return res;
    }
}